package com.dsg.kf.socket.handler;

import java.util.concurrent.ConcurrentHashMap;

import org.springframework.stereotype.Component;

import com.corundumstudio.socketio.AckRequest;
import com.corundumstudio.socketio.SocketIOClient;
import com.corundumstudio.socketio.annotation.OnEvent;
import com.dsg.kf.common.util.SpringUtil;
import com.dsg.kf.socket.interfa.SocketService;
import com.dsg.kf.socket.message.Room;
import com.dsg.kf.socket.message.User;
/**
 * 测试用的，测试 异步调用service处理业务
 * @author pacy.pan
 *
 */
@Component
public class TestHandler {

    public static final ConcurrentHashMap<String, Room> rooms = new ConcurrentHashMap<String, Room>();

    @OnEvent(value = "test")
    public void actite(SocketIOClient client, User user, AckRequest ackRequest) {
    	Object obj = SpringUtil.getApplicationContext().getBean("testService");
    	if(obj!=null){
    		SocketService service = (SocketService)obj;
    		service.doSocketService(user, client);
    	}
    }

}
